#ifndef CONSTANTS_H
#define CONSTANTS_H

#include "stable.h"

namespace Utils
{
    QString formatHm( quint32 seconds );
    QString formatMs( quint32 seconds );
}

class Constant
{
public:
    static const QString appname;
    static const QString appver;
    static const QString orgname;
    static const QString orgdomain;
    static const QString dbname;
    static const QString mapextension;
    static const QString mapurlstart;
};

class Strings
{
public:
    static const QString noviaje;
    static const QStaticText superficie;
};

class Default
{
public:
    static const QString dateformat;
    static const QString timeformat;
    static const quint32 meterspergridline;
    static const quint32 secondspergridline;
    static const quint32 degreespergridline;
    static const quint32 degreesrange;
};

class Unidad
{
public:
    static const QString temperatura;
    static const QString profundidad;
    static const QString volumen;
    static const QString presion;
    static const QString peso;
    static const QString porcentaje;
    static const QString minutoscomilla;
    static const QString segundoscomillas;
};

class Marcador
{
public:
    static const QString superficie;
    static const QString avisoascenso;
    static const QString avisorgbm;
    static const QString pso;
    static const QString errortechopso;
};

class qnuint
{
public:
    qnuint() : _isnull( true ), _value(0) {}
    qnuint( quint32 value ) : _value( value ), _isnull( false ) {}
    void setValue( quint32 value ) { _value = value; _isnull = false; }
    void setNull( bool isnull ) { _isnull = isnull; if( isnull ) _value = NULL; }
    quint32 value() const { if( _isnull ) return NULL; else return _value; }
    bool isNull() const { return _isnull; }
private:
    quint32 _value;
    bool _isnull;
};

class qnreal
{
public:
    qnreal() : _isnull( true ), _value(0) {}
    qnreal( qreal value ) : _value( value ), _isnull( false ) {}
    void setValue( qreal value ) { _value = value; _isnull = false; }
    void setNull( bool isnull ) { _isnull = isnull; if( isnull ) _value = NULL; }
    qreal value() const { if( _isnull ) return NULL; else return _value; }
    bool isNull() const { return _isnull; }
private:
    qreal _value;
    bool _isnull;
};

#define MAP_MAXWIDTH 1000
#define MAP_MAXHEIGHT 600

#define SEGUNDOS_EN_MINUTO 60
#define MINUTOS_EN_HORA 60
#define HORAS_EN_DIA 24
#define DIAS_EN_SEMANA 7
#define SEGUNDOS_EN_HORA (SEGUNDOS_EN_MINUTO*MINUTOS_EN_HORA)
#define SEGUNDOS_EN_DIA (SEGUNDOS_EN_MINUTO*MINUTOS_EN_HORA*HORAS_EN_DIA)

#endif // CONSTANTS_H
